package com.mjl.shops.activity;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.Window;

import com.mjl.shops.R;
import com.mjl.shops.adapter.AddressAdapter;
import com.mjl.shops.base.BaseActivity;
import com.mjl.shops.base.BaseDate;
import com.mjl.shops.bean.AddressBean;
import com.mjl.shops.utils.CommUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MineAddressActivity extends BaseActivity {

    private List<AddressBean> addressBeans = new ArrayList<>();

    private AddressAdapter addressAdapter;

    @BindView(R.id.address_recycler)
    RecyclerView addressRecycler;

    @Override
    protected void setContentViewBefore() {
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    }

    @Override
    protected int getViews() {
        return R.layout.activity_mine_address;
    }

    @Override
    protected void setViews() {
        ButterKnife.bind(this);
    }

    @Override
    protected void setDate() {
        addressBeans.clear();
        addressBeans.addAll(BaseDate.getAddress());
        addressAdapter = new AddressAdapter(R.layout.item_address_layout,addressBeans);
        addressRecycler.setLayoutManager(new LinearLayoutManager(this));
        addressRecycler.setAdapter(addressAdapter);
    }

    @Override
    protected String getStateColor() {
        return CommUtils.color_05000000;
    }

    @Override
    protected int getStetaBackgroundStyle() {
        return 1;
    }

    @OnClick({R.id.icon_back,R.id.add_address_tv})
    public void OnClick(View view) {
        switch (view.getId()) {
            case R.id.icon_back:
                finish();
                break;
            case R.id.add_address_tv:
                AddressAddActivity.StartIntent(MineAddressActivity.this);
                break;
            default:
                break;
        }
    }

    public static void StartIntent(Context contexts){
        Intent intent = new Intent(contexts,MineAddressActivity.class);
        contexts.startActivity(intent);
    }
}
